local thbattle__dayaojing_zhiyuan = fk.CreateSkill {

  name = "thbattle__dayaojing_zhiyuan",

  tags = {  },

}



thbattle__dayaojing_zhiyuan:addEffect("active", {
  prompt = "#thbattle__dayaojing_zhiyuan",
  anim_type = "support",
  card_filter = Util.TrueFunc,
  target_filter =function (self, player, to_select, selected, selected_cards, card, extra_data)
       return #selected == 0 and to_select ~= player
  end,
  target_num = 1,
  min_card_num = 1,
  on_use = function(self, room, effect)
    local target = effect.tos[1]
    local player = effect.from
    local cards = effect.cards
    local marks = player:getMark("thbattle__dayaojing_zhiyuan-phase")
    room:moveCardTo(cards, Player.Hand, target, fk.ReasonGive, thbattle__dayaojing_zhiyuan.name, nil, false, player)
    room:addPlayerMark(player, "thbattle__dayaojing_zhiyuan-phase", #cards)
    if marks < 3 and marks + #cards >= 3 and not player.dead and player:isWounded() then
      room:recover {
        who = player,
        num = 1,
        recoverBy = player,
        skillName = thbattle__dayaojing_zhiyuan.name
      }
    end
  end,
})

return thbattle__dayaojing_zhiyuan